//
//  YWNotifyManager.m
//  maintain
//
//  Created by 郑想 on 15/11/6.
//  Copyright © 2015年 ewin. All rights reserved.
//

#import "YWMission.h"
#import "YWNotifyManager.h"
#import "YWPush.h"

@interface YWNotifyManager ()

@property NSNotificationCenter* center;

@end

@implementation YWNotifyManager
YWSingletonM(Manager)

- (instancetype)init
{
    self = [super init];
    if (self) {
        _center = [NSNotificationCenter defaultCenter];
    }
    return self;
}


- (void)addMissionFinishedObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_MISSION_FINISHED object:nil];
}

- (void)removeMissionFinishedObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_MISSION_FINISHED object:nil];
}

- (void)postMissionFinishedNotifyWithMission:(id)mission
{
    [_center postNotificationName:NOTIFICATION_MISSION_FINISHED object:mission];
}

- (void)addPostTroubleObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_POST_TROUBLE_FINISHED object:nil];
}

- (void)removePostTroubleObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_POST_TROUBLE_FINISHED object:nil];
}

- (void)postTroubleNotifyWithStatu:(NSString*)equipmentId;
{
    [_center postNotificationName:NOTIFICATION_POST_TROUBLE_FINISHED object:equipmentId];
}

- (void)addRefreshMissionObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_REFRESH_MISSION object:nil];
}

- (void)removeRefreshMissionRecordObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_REFRESH_MISSION object:nil];
}

- (void)postRefreshMissionNotifyWithType
{
    [_center postNotificationName:NOTIFICATION_REFRESH_MISSION object:nil];
}

- (void)addMissionProgressObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_MISSION_PROGRESS object:nil];
}

- (void)removeMissionProgressObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_MISSION_PROGRESS object:nil];
}

- (void)postMissionProgressNotify:(NSDictionary*)dic
{
    [_center postNotificationName:NOTIFICATION_MISSION_PROGRESS object:dic];
}

- (void)addRequestTroubleMissionObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_assign_troubleMission object:nil];
}

- (void)removeRequestTroubleMissionObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_assign_troubleMission object:nil];
}

- (void)postRequestTroubleMissionNotify:(NSInteger)missionId
{
    [_center postNotificationName:NOTIFICATION_assign_troubleMission object:@(missionId)];
}

//- (void)addLastMaintenanceTimeObserver:(id)target selector:(SEL)selector
//{
//    [_center addObserver:target selector:selector name:NOTIFICATION_LASTMAINTENANCETIME object:nil];
//}
//
//- (void)removeLastMaintenanceTimeObserver:(id)target
//{
//    [_center removeObserver:target name:NOTIFICATION_LASTMAINTENANCETIME object:nil];
//}
//
//- (void)postLastMaintenanceTimeNotify
//{
//    [_center postNotificationName:NOTIFICATION_LASTMAINTENANCETIME object:nil];
//}

- (void)addModifySelfHeadIconObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_MODIFYSELFHEADICON object:nil];
}

- (void)removeModifySelfHeadIconObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_MODIFYSELFHEADICON object:nil];
}

- (void)postModifySelfHeadIconNotify
{
    [_center postNotificationName:NOTIFICATION_MODIFYSELFHEADICON object:nil];
}

- (void)postAssignDetectMissionNotify{
    [_center postNotificationName:NOTIFICATION_assign_detectMission object:nil];
}

- (void)addAssignDetectMissionObserver:(id)target selector:(SEL)selector{
    [_center addObserver:target selector:selector name:NOTIFICATION_assign_detectMission object:nil];
}

- (void)postAssignUpKeepMissionNotify{
    [_center postNotificationName:NOTIFICATION_assign_upKeepMission object:nil];
}

- (void)addAssignUpKeepMissionObserver:(id)target selector:(SEL)selector{
    [_center addObserver:target selector:selector name:NOTIFICATION_assign_upKeepMission object:nil];
}

- (void)postAssignInspectMissionNotify{
    [_center postNotificationName:NOTIFICATION_assign_inspectMission object:nil];
}

- (void)addAssignInspectMissionObserver:(id)target selector:(SEL)selector{
    [_center addObserver:target selector:selector name:NOTIFICATION_assign_inspectMission object:nil];
}

- (void)postAssignKeepWatchMissionNotify{
    [_center postNotificationName:NOTIFICATION_assign_keepWatchMission object:nil];
}

- (void)addAssignKeepWatchMissionObserver:(id)target selector:(SEL)selector{
    [_center addObserver:target selector:selector name:NOTIFICATION_assign_keepWatchMission object:nil];
}

- (void)addReflashPatrolLineViewObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_ReflashPatrolLineView object:nil];
}

- (void)removeReflashPatrolLineViewObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_ReflashPatrolLineView object:nil];
}

- (void)postReflashPatrolLineViewNotify
{
    [_center postNotificationName:NOTIFICATION_ReflashPatrolLineView object:nil];
}

//

- (void)addPushTempMissionObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_PUSH_TEMPMISSION object:nil];
}

- (void)removePushTempMissionObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_PUSH_TEMPMISSION object:nil];
}

- (void)postPushTempMissionNotify:(YWPushWorkTask*)workTask
{
    [_center postNotificationName:NOTIFICATION_PUSH_TEMPMISSION object:workTask];
}
//

- (void)addPushNoticeObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_PUSH_NOTICE object:nil];
}

- (void)removePushNoticeObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_PUSH_NOTICE object:nil];
}

- (void)postPushNoticeNotify:(YWPushWorkNotice*)notice
{
    [_center postNotificationName:NOTIFICATION_PUSH_NOTICE object:notice];
}

- (void)addDeleteMissionObserver:(id)target selector:(SEL)selector
{
    [_center addObserver:target selector:selector name:NOTIFICATION_MISSION_DELETE object:nil];
}

- (void)removeDeleteMissionObserver:(id)target
{
    [_center removeObserver:target name:NOTIFICATION_MISSION_DELETE object:nil];
}

- (void)postDeleteMissionNotify:(YWPushCancelMission*)pushMission
{
    [_center postNotificationName:NOTIFICATION_MISSION_DELETE object:pushMission];

}
@end
